/*
 * VideoWindow.h
 *
 *  Created on: 2018年6月9日
 *      Author: zhengboyuan
 */

#ifndef VIDEOWINDOW_H_
#define VIDEOWINDOW_H_

#include "MediaType.h"

struct AVFrame;
struct AVPacket;

namespace av
{

enum DrawGraphMode
{
	DRAW_GRAPH_NONE = 0,	/// 禁止绘制图形
	DRAW_GRAPH_RECT,
	DRAW_GRAPH_POLYGON
};

class VideoWindowEventSink
{
public:
	virtual ~VideoWindowEventSink() {}

	virtual void onMouseButtonDown(int which, int x, int y, int modifier) =0;
	
	virtual void onMouseButtonUp(int which, int x, int y) =0;

	virtual void onMouseButtonDblClick(int which, int x, int y) =0;

	virtual void onMouseEnter(int x, int y) =0;

	virtual void onMouseLeave(int x, int y) =0;

};


class VideoWindow
{
public:
    virtual ~VideoWindow() {}

    virtual int open(void* hwnd) =0;
    virtual void close() =0;
    virtual bool isOpen() =0;

    virtual void setState(StreamState state) =0;

    virtual bool draw(AVFrame* frame) =0;

    virtual void flush() =0;

    virtual bool setRatio(int width, int height) =0;

    virtual void setVisible(bool visible) =0;

    virtual bool isFullscreen() =0;

    virtual bool setFullscreen(bool full) =0;

    virtual bool setBackImage(const char* filepath) =0;

	virtual void drawText(AVPacket* pkt) =0;

    /**
     * 运行/禁止鼠标绘制图形
     * @param mode	绘制模式, @see DrawGraphMode
     */
    virtual void enableDrawGraph(int mode) =0;

    /**
     * 设置绘制图形, JSON 格式
     * @param value	JSON字符串, 为NULL或者空表示清理图形
     * @param size
     */
    virtual void setDrawGraph(const char* value, size_t size) =0;

    /**
     * 获取绘制图形, JSON 格式
     * @return
     */
    virtual const char* getDrawGraph() =0;

	virtual void setSink(VideoWindowEventSink* sink) =0;

};


} /* namespace av */

#endif /* VIDEOWINDOW_H_ */
